package com.example.librarysystem.Service;

import com.example.librarysystem.Dao.TimesDao;
import com.example.librarysystem.entity.Times;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("timesService")
public class TimesServiceImpl implements TimesService {
    @Autowired
    private TimesDao timesDao;

    @Override
    @Transactional(timeout = 30)
    public int updateSearchTimes(Times times){
        timesDao.updateSearchTimes(times);
        return 0;
    }
    @Override
    @Transactional(timeout = 30)
    public int updateClickTimes(Times times){
        timesDao.updateClickTimes(times);
        return 0;
    }
    @Override
    public Times selectByName(String bookName){
        return timesDao.selectByName(bookName);
    }
    @Override
    public List<Times> selectAllByClickDesc(){
        return timesDao.selectAllByClickDesc();
    }
    @Override
    public List<Times> selectAllBySearchDesc(){
        return timesDao.selectAllBySearchDesc();
    }
}
